﻿#region Opis pliku
//-----------------------------------------------------------------------------
// MenuMouseEmitter.cs
// Autor: Jan Czarnowski
// 12.11.2012
//-----------------------------------------------------------------------------
#endregion

#region Using...

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using System.Collections.Generic;
using System;

#endregion


namespace pogra
{
    /// <summary>
    /// Klasa emitera, który podąża za myszką. Służy do wyświetlania efektów
    /// cząsteczkowych przy kursorze, w menu. Obecnie nieużywane
    /// </summary>
    class MenuMouseEmitter : Emitter
    {
        #region pola

        TimeSpan timeForNewParticle = TimeSpan.Zero;
        Texture2D particleBase2;
        SpriteFont font;

        #endregion

        #region inicjalizacja

        public MenuMouseEmitter(Vector2 position, Texture2D particleBase1, Texture2D particleBase2, SpriteFont font) : base(position, particleBase1)
        {
            this.particleBase2 = particleBase2;
            this.font = font;
        }

        #endregion

        #region logika

        protected override bool deathLogic()
        {
            return true;
        }

        protected override void GenerateParticles()
        {
            if (timeForNewParticle <= TimeSpan.Zero)
            {
                int type = Rand.next(0, 2);

                float vel = 35;
                float rot = Rand.nextFloat(0, Math.PI);

                string text;

                if (type == 1)
                    text = "0";
                else
                    text = "1";

                particleList.AddLast(new MenuParticle(particleBase, Pos + new Vector2(0, 15), vel, rot, TimeSpan.FromMilliseconds(1500), font, text));

                timeForNewParticle = TimeSpan.FromMilliseconds(200);
            }
        }

        protected override void miniUpdate(TimeSpan gameTime)
        {
            timeForNewParticle -= gameTime;
        }


        #endregion
    }
}
